home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir34
/
dsktest.zip
/
DTEST.DOC
< prev
next >
Wrap
Text File
|
1993-05-25
|
6KB
|
167 lines
THIS IS MODIFIED FROM AN ARTICLE IN PC COMPUTING, APR 91, page 176.
Syntax: DTEST D: where D: = a floppy drive letter
A DT.BAT file is provided which simplifies use. It can be modified to
your own purposes.
Results from DTEST are stored in errorlevels as shown below.
These have been modified from those in the original article to reflect
a more consistent approach. For example, the original version had the
two answers for formatted disks returning non-sequential EL's, in
fact, they were at the extremes, 0 and 4. The arrangement used here
treats higher EL's as representing increasing degree of "problem."
0 disk is formatted--no files, no label
1 disk is formatted--
has files on it
and/or has a volume label.
Byte 149 defines this errorlevel code.
2 disk is unformatted
3 no disk in drive
NOTE: A formatted disk that has a volume label will return EL=1 regardless of
whether or not it has files on it. This is because a volume label resides in
the disk's directory structure and will appear to be a file to DTEST.
DTEST.SCR (usage is DEBUG<DTEST.SCR to create DTEST.COM)
There must be a blank line after "Q".
N DTEST.COM
E100 A0 80 00 0A C0 74 0D A0 82 00 24 5F 2E A2 52 01
E110 2C 41 EB 02 B0 00 B9 01 00 BA 00 00 BB 59 01 CD
E120 25 73 12 80 FC 1F 73 09 80 FC 08 74 04 B0 02 EB
E130 1D B0 03 EB 19 BA 80 00 B4 1A CD 21 B4 4E BA 52
E140 01 B9 FF FF CD 21 72 04 B0 01 EB 02 B0 00 B4 4C
E150 CD 21 41 3A 5C 2A 2E 2A 00
RCX
59
W
Q
----------------------
Dissasembly of DTEST.COM using DEBUG "u" command:
-u100 158
1471:0100 A08000 MOV AL,[0080]
1471:0103 0AC0 OR AL,AL
1471:0105 740D JZ 0114
1471:0107 A08200 MOV AL,[0082]
1471:010A 245F AND AL,5F
1471:010C 2E CS:
1471:010D A25201 MOV [0152],AL
1471:0110 2C41 SUB AL,41
1471:0112 EB02 JMP 0116
1471:0114 B000 MOV AL,00
1471:0116 B90100 MOV CX,0001
1471:0119 BA0000 MOV DX,0000
1471:011C BB5901 MOV BX,0159
1471:011F CD25 INT 25
1471:0121 7312 JNB 0135
1471:0123 80FC1F CMP AH,1F
1471:0126 7309 JNB 0131
1471:0128 80FC08 CMP AH,08
1471:012B 7404 JZ 0131
1471:012D B001 MOV AL,02
1471:012F EB1D JMP 014E
1471:0131 B002 MOV AL,03
1471:0133 EB19 JMP 014E
1471:0135 BA8000 MOV DX,0080
1471:0138 B41A MOV AH,1A
1471:013A CD21 INT 21
1471:013C B44E MOV AH,4E
1471:013E BA5201 MOV DX,0152
1471:0141 B9FFFF MOV CX,FFFF
1471:0144 CD21 INT 21
1471:0146 7204 JB 014C
1471:0148 B004 MOV AL,01
1471:014A EB02 JMP 014E
1471:014C B000 MOV AL,00
1471:014E B44C MOV AH,4C
1471:0150 CD21 INT 21
1471:0152 41 INC CX
1471:0153 3A5C2A CMP BL,[SI+2A]
1471:0156 2E CS:
1471:0157 2A00 SUB AL,[BX+SI]
-------- DT.BAT ----------
@echo off
If (%1)==() goto NOPARAM
for %%A in ( c: C: d: D: e: E: f: F: g: G: ) do if %1==%%A goto NOPARAM
dtest %1
echo.
call errlev.bat
if errorlevel 3 goto NODISK
if errorlevel 2 goto UNFOR
if errorlevel 1 goto FILES-OR-VOL
if errorlevel 0 goto NOFILESNOVOL
REM Modify the following sections to perform the actions you want
REM to happen depending on the status of the disk test.
:NODISK
echo.
echo there is no disk in %1
echo.
goto END
:UNFOR
echo.
echo the disk in %1 is unformatted
echo.
goto END
:FILES-OR-VOL
echo.
echo the disk in %1 is formatted and has files and/or a volume label
echo.
goto END
:NOFILESNOVOL
echo.
echo the disk in %1 is formatted and has neither a volume label nor files on it.
echo.
goto END
:NOPARAM
echo.
echo A floppy disk must be specified. Use DT a: =or= DT b:
echo ...or a hard disk drive was named. Specify only floppies.
echo.
:END
---------- End of DT.BAT -------------
---------- Begin ERRLEV.BAT ----------
@echo off
rem Use CALL ERRLEV.BAT (DOS 3.3+) in a batch file to place the errorlevel
rem into the environment as EL=xxx where xxx is an ASCII(!) string
rem representation of the errorlevel. It is also written to the screen.
set EL=
for %%V in (0 1 2) do if errorlevel %%V00 set EL=%%V
if "%EL%"=="2" goto OVER200
for %%V in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %EL%%%V0 set EL=%EL%%%V
goto DIGIT2
:OVER200
for %%V in (0 1 2 3 4 5) do if errorlevel %EL%%%V0 set EL=%EL%%%V
:DIGIT2
if "%EL%"=="25" goto OVER250
goto DIGIT3
:OVER250
for %%V in (0 1 2 3 4 5) do if errorlevel %EL%%%V set EL=%EL%%%V
goto DONE
:DIGIT3
for %%V in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %EL%%%V set EL=%EL%%%V
:DONE
echo The resulting ERRORLEVEL value transferred to the environment is EL=%EL%
--------- End ERRLEV.BAT --------------